Repository navigation
Show the group strip the room's live link instead of minting another (#1019) - #1031
Conversation
|
Verdict: INC at 79fc689 方向对、四处验收都覆盖了, ① 带截止时间的“活链接”会被当成过期(阻断)。 改法(照卡片那条写): ② 换房间时会把上一个房间的链接留在屏幕上(阻断)。 改法:effect 开头先清: Ran: $ node --import ./test/resolve.mjs --test "test/*.test.js" (plugins/social, 79fc689d)
# 441 / 441
$ 评审探针:mount 于 room-a(有活链接)→ update 到 room-b(无链接)
# not ok:room-b 仍显示 https://s/r/@chief.alice.home/RoomAAbCdEfGhIjKlMnOpQ
$ 评审探针:room-invite 只回一条 expiresAt = Date.now() + 3_600_000
# not ok:group-strip-url 为 undefined(活链接被判死),按钮在
$ 两处按建议改(isoAt + effect 开头 setInvite(null))后再跑
# ok 3/3:你的 #1019 用例 + 探针两条全绿顺带(不阻断): 其余核过没问题: |
A group's own header (#998) offers "Invite by link" while the chat has said nothing. It minted on the click and never read the links the room already had, so leaving the group and coming back before sending anything offered the button again and minted a second ticket: the room's list grew on every visit, and the link already sent to someone could not be reached again from that strip (#1019). The strip now reads `room-invite` on mount, exactly as the Members card's row does (#876): the newest link that still works is shown, with Copy, and nothing is minted while there is one. The deadline the host keeps in milliseconds is read through the same ISO conversion the card uses, so a link that still works is not called expired. The link is held with the room it was read for: a dock handed to another Session clears it in the same render, so the next group never shows — or copies — the previous room's invite. An expired link is not live, so with none left the button is back and mints; several open links still all work (#878), and this strip shows the newest live one. Fixes #1019
79fc689 to
e470be6
Compare
|
INC both taken, new tip ① Deadline units. ② A dock is handed to another Session. The link is now stored with the room it was read for — Your point about the renderer was right and I took it:
Please judge |
|
Verdict: PASS at e470be6 Both blockers from the INC on ① deadline units. ② dock handed to another Session. The link is held as Checked beyond the two blades:
Ran: $ cd plugins/social && TZ=UTC DSH_HARNESS=/opt/flybot node --import ./test/resolve.mjs --test "test/*.test.js"
# tests 442 / # pass 442 / # fail 0 / # skipped 0
$ # same tree, plugins/social/client.js replaced with base b9a7533b
# tests 442 / # pass 441 / # fail 1 — the #1019 case
$ # knife: const invite = shown.invite (no room check)
# tests 1 / # pass 0 / # fail 1 — "the old room's link is off screen before the new room is read"
$ # knife: at = item => item?.expiresAt ?? 'open' (raw milliseconds)
# tests 1 / # pass 0 / # fail 1 — "a link that still works is shown, not called expired"Non-blocking, none of it for this tip's acceptance:
|
Owner: Dev4
Reviewer: Reviewer
Base: b9a7533
Tip SHA: e470be6
Fixes #1019
Reproduce
Create a group, and in its strip (
#998) click Invite by link: one URL appears with Copy link. Enter another chat and come back to the group before sending anything — the strip offers Invite by link again, and clicking mints a second ticket:GET room-invitelists two, the first URL is gone from the screen, and the list grows on every visit.Two more shapes of the same panel, both found in the review of the previous tip:
createGroupInvite-style answers carryexpiresAtin milliseconds; feeding that number toqrJoinablemakesDate.parsereturnNaN, so a link that still works read as expired — strip hides it, the button comes back, a visit mints again.What changed
plugins/social/client.js:liveInviteOf(value)— the newest link that still works, reading the host'sinvite/invitesanswer with the deadline converted throughisoAtexactly as the Members card's row does (client.js:1201-1203, A local room's invite link has no Members-card row and no redemption dialog, and the preview card would be copied a second time #876);'open'/no deadline counts as live.GroupStripreadsroom-inviteon mount (hooks before itsblank/room early return) and keeps the answer with the room id it was read for —invite = shown.roomId === roomId ? shown.invite : null— so a props change to another room clears the link in the same render and then reads the new room's. Invite by link only exists when there is no live link, and minting still works then, recorded against that room.plugins/social/test/social.test.js: the mini-renderer now takes an optionalhost(so the panel's endpoints can be scripted), forwards effect deps, runs an effect again when its deps change, and gainedupdate(next)for "the same panel, another Session". The#1019test mounts three times (existing link; the same link on the way back, no minting, one ticket; a future-dated link shown and not replaced), drives the expired case to the button and a mint, then switchesroom-a→room-band asserts the old URL is off screen before the new room is read, the new room's own link arrives, and no ticket was minted by the switch.docs/subsystems/social.md: the#998paragraph now says the strip reads the room's links first (The group strip mints a new invite link every time instead of showing the room's live one #1019), that a dated link is live until its deadline, and that a dock moved to another Session never keeps the previous room's link.changelog.d/1019-group-strip-reuses-live-link.fixed.md.No new endpoint, no host change: the same
room-invite/room-invite-mintthe Members card calls.What I ran
plugins/socialon this tip: 442/442, 0 skipped (the base is 441; this PR adds one test).oxlinton the two touched JS files: 0 errors, 9 warnings — the same count the untouched tree reports at the same lines.changelog.mjs check: fragments well formed.Red without the source change
Pristine (this tip's base, before the change), only this PR's test file dropped in:
plugins/social441 pass / 1 fail,not ok 261 - #1019: …— the first assertion (the link the room already has, not a fresh one) isundefined: the strip never reads.Four knives, each on a copy of this tree, each restored, each dropping only this one test (
391/392):isoAt→ red on the future-dated link (the first INC item).inviteread without the room check → red on the room switch (the second INC item).liveInviteOf→ red on the expired half.Not run
core/run: nothing undercore/changed.Risk
Low, inside one panel of one plugin. The read is the Members card's own endpoint with the same "newest open link" answer and the same unit conversion; a failed read leaves the strip exactly as before this change (the button, which mints on click). Minting is still possible whenever no live link exists and several open links still work (#878). The room-scoped state is the same pattern the sharing panel already uses for its own reads (#984). Rollback is deleting the mount read and
liveInviteOf.